home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / alv.sun / alv.lha / src / p_main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-08  |  2.6 KB  |  90 lines

  1. /************************************ palette_main.c ********/
  2.  
  3. /* Palettetool.c, a color palette and code generation tool.
  4.  *
  5.  * Copyright (c) 1987, Sun Microsystems, Inc.
  6.  *
  7.  * Note:  this code is completely unsupported.
  8.  *
  9.  * Change Notes: (7/1/87, by hsc%vanderbilt@csnet-relay)
  10.  *        1) a colormap stripe is added to reflect the
  11.  *           spectrum change while modifying the single
  12.  *           entry;
  13.  *        2) colormap file generated is formatted to
  14.  *           our local specs.
  15.  *
  16.  */
  17. #include "p_include.h"
  18. #include "p_icons.h"
  19.  
  20. ain(argc, argv)
  21. nt    argc;
  22. har    **argv;
  23. {
  24.     progname = strsave(*argv);
  25.     palette_init();
  26.  
  27.     base_frame = window_create(NULL, FRAME,
  28.             FRAME_ICON, &palette_icon,
  29.         FRAME_LABEL, "palettetool",
  30.             FRAME_ARGS, argc, argv,
  31.             0);
  32.  
  33.     control_panel = window_create(base_frame, PANEL,
  34.             WIN_WIDTH, 560,
  35.             0);
  36.  
  37.     panel_creation();
  38.  
  39.     display_canvas = window_create(base_frame, CANVAS,
  40.             WIN_X, 0,
  41.             WIN_BELOW, control_panel,
  42.             CANVAS_AUTO_SHRINK, FALSE,
  43.             WIN_HEIGHT, 3*MAX_CMAP_LEN-(int)window_get(control_panel, WIN_HEIGHT)-11*(xspace+cwidth)+2*xoff,
  44.             WIN_WIDTH, (int) window_get(control_panel, WIN_WIDTH),
  45.             WIN_VERTICAL_SCROLLBAR, scrollbar_create(0),
  46.             WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0),
  47.             WIN_EVENT_PROC, display_event_proc,
  48.             WIN_CONSUME_PICK_EVENTS, MS_LEFT, MS_MIDDLE, MS_RIGHT, 0,
  49.             0);
  50.     multiple_canvas = window_create(base_frame, CANVAS,
  51.             WIN_X, 0,
  52.             WIN_BELOW, display_canvas,
  53.            WIN_WIDTH, (int)window_get(control_panel, WIN_WIDTH), /*24*(xspace+cwidth)+2*xoff,*/
  54.           WIN_HEIGHT, 11*(yspace+cheight)+2*yoff,
  55.                 CANVAS_AUTO_SHRINK, FALSE,
  56.             WIN_EVENT_PROC, multiple_canvas_event_proc,
  57.             0);
  58.  
  59.           brush_cursor = cursor_create(CURSOR_IMAGE, &brushpix,
  60.                       CURSOR_XHOT, 8, CURSOR_YHOT, 7,
  61.                       CURSOR_OP, PIX_SRC|PIX_DST,
  62.                       0);
  63.  
  64.     window_set(multiple_canvas, WIN_CURSOR, brush_cursor, 0);
  65.  
  66.     single_canvas = window_create(base_frame, CANVAS,
  67.             WIN_RIGHT_OF, control_panel,
  68.             WIN_Y, 0,
  69.             WIN_WIDTH, 100,
  70.             WIN_HEIGHT,  (int)window_get(display_canvas, WIN_HEIGHT) + (int) window_get(multiple_canvas, WIN_HEIGHT)+(int)window_get(control_panel,WIN_HEIGHT)+10, /*3*MAX_CMAP_LEN,*/
  71.                 CANVAS_AUTO_SHRINK, FALSE,
  72.             WIN_EVENT_PROC, single_canvas_event_proc,
  73.         WIN_CONSUME_PICK_EVENTS, MS_LEFT, MS_MIDDLE, MS_RIGHT, 0,
  74.         CANVAS_REPAINT_PROC, paint_single_canvas,
  75.             0);
  76.  
  77.     put_colors(0, MAX_CMAP_LEN, r, g, b);
  78.      paint_multiple_canvas();
  79.     paint_single_canvas();
  80.  
  81.     panel_set_value(red_slider, r[selected_n]);
  82.     panel_set_value(green_slider, g[selected_n]);
  83.     panel_set_value(blue_slider, b[selected_n]);
  84.  
  85.     window_fit(base_frame);
  86.  
  87.     window_main_loop(base_frame);
  88.  
  89. }
  90.